package cn.com.acca.ma.dao.impl;

import cn.com.acca.ma.dao.ModelTopConceptBoardIndexDetailDao;
import cn.com.acca.ma.hibernate.util.HibernateUtil;
import org.hibernate.SQLQuery;

public class ModelTopConceptBoardIndexDetailDaoImpl extends BaseDaoImpl<ModelTopConceptBoardIndexDetailDaoImpl> implements
        ModelTopConceptBoardIndexDetailDao {

    /**
     * 按照日期，向表MDL_TOP_CNCPT_BOARD_IDX_DETAIL中写入数据
     * @param beginDate
     * @param endDate
     */
    @Override
    public void writeModelTopConceptBoardIndexDetailByDate(String beginDate, String endDate) {
        logger.info("按照日期【" + beginDate + "】和【" + endDate
                + "】，向表MDL_TOP_CNCPT_BOARD_IDX_DETAIL中写入数据");

        session = HibernateUtil.currentSession();
        session.beginTransaction();
        SQLQuery query = session
                .createSQLQuery("{call PKG_CONCEPT_BOARD.WRITE_MDL_TOP_C_B_I_DETAIL(?, ?)}");
        query.setParameter(0, beginDate);
        query.setParameter(1, endDate);
        query.executeUpdate();

        session.getTransaction().commit();
        session.close();

        logger.info("按照日期【" + beginDate + "】和【" + endDate
                + "】，向表MDL_TOP_CNCPT_BOARD_IDX_DETAIL中写入数据完毕");
    }
}
